package com.xiegang.apipassenger.Service;

import com.xiegang.apipassenger.remote.ServicePassengerUserClient;
import com.xiegang.internalcommon.dto.ResponseResult;
import com.xiegang.internalcommon.dto.TokenResult;
import com.xiegang.internalcommon.util.JWTUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author xieGang
 * @description
 * @date 2023/3/9 19:32
 **/
@Service
public class UserService {


    @Autowired
    private ServicePassengerUserClient servicePassengerUserClient;

    public ResponseResult getUesrByPhone(String accessToken){

        TokenResult tokenResult = JWTUtil.parseToken(accessToken);

        String phone = tokenResult.getPhone();

        return servicePassengerUserClient.getUesrByPhone(phone);
    }
}
